package userwashlogic

import (
	"context"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/model/userwash"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UpdateStatusLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUpdateStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateStatusLogic {
	return &UpdateStatusLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UpdateStatusLogic) UpdateStatus(in *rpc.UpdateStatusRequest) (*rpc.UpdateStatusResponse, error) {
	if err := userwash.NewUserWashDescModel(l.ctx, l.svcCtx.Db).UpdateStatus(in.Id, in.Status); err != nil {
		return nil, err
	}
	return &rpc.UpdateStatusResponse{}, nil
}
